//
//  MainViewController.swift
//  SinaWeibo
//
//  Created by frankyscofield on 16/1/10.
//  Copyright © 2016年 frankyscofield. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        addChildViewControllers()
        
    }

    func addChildViewControllers() {
        
        addChildViewController(HomeTableViewController(), imageName: "tabbar_home", title: "Homepage")
        addChildViewController(MessageTableViewController(), imageName: "tabbar_message_center", title: "Message")
        addChildViewController(DiscoveryTableViewController(), imageName: "tabbar_discover", title: "Discovery")
        addChildViewController(ProfileTableViewController(), imageName: "tabbar_profile", title: "Me")
        
    }
    
    func addChildViewController(vc: UIViewController, imageName: String, title: String) {
        
        vc.tabBarItem.image = UIImage(named: imageName)
        
        vc.title = title
        
        let navi = UINavigationController(rootViewController: vc)
        
        addChildViewController(navi)
        
    }

}
